// logs.js

Page({
  data:{
    list:[{
      name:"王一博",
      age:30,
      sex:0,
      status:true,
      pic:"http://p4.itc.cn/images01/20200712/abc792ef60204810b7b144eda699ca0c.jpeg"
    },{
      name:"易烊千玺",
      age:22,
      sex:0,
      status:true,
      pic:"http://www.sd.xinhuanet.com/news/yule/2018-07/18/1123141942_15318763449741n.jpeg"
    },{
      name:"宋轶",
      age:28,
      sex:1,   
      status:false,
      pic:"https://c-ssl.duitang.com/uploads/item/201907/25/20190725213829_koneh.thumb.700_0.jpg"
    },{
      name:"李智恩",
      age:26,
      sex:1,
      status:true,    
      pic:"https://c-ssl.duitang.com/uploads/item/202001/15/20200115101013_hcohu.thumb.400_0.jpg"
    }],
    name:"",
    age:null,
    sex:null,
    gender:['男','女'],
    status:false  
  },
  submit(){
    console.log('点击了');   
    console.log(this.data);
    const obj = {
      name:this.data.name,
      age:this.data.age,
      sex:this.data.sex,
      status:this.data.status
    }
    console.log(obj); 
    this.setData({
      list:[obj,...this.data.list]    
    })     
    // this.data.list.push(obj)  
    // this.setData({
    //   list:this.data.list     
    // })   
  },
  del(e){
    console.log(e.currentTarget.dataset.index);
    const idx = e.currentTarget.dataset.index
    this.data.list.splice(idx,1)
    this.setData({
      list:this.data.list
    })
  }     
})
